package com.example.springcloud.service;

import com.example.springcloud.mapper.DeptMapper;
import com.example.springcloud.pojo.Dept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author :lihao
 * @date :2020/11/16
 * @description :
 */
@Service
public class DeptServiceImpl implements DeptService{

    @Autowired
    private DeptMapper deptMapper;

    /**
     * 添加一个部门
     *
     * @param dept 部门实体
     * @return 添加结果
     */
    @Override
    public boolean addDepartment(Dept dept) {
        return deptMapper.addDepartment(dept);
    }

    /**
     * 通过id查部门
     *
     * @param id 部门id
     * @return 部门信息
     */
    @Override
    public Dept queryDeptById(Long id) {
        return deptMapper.queryDeptById(id);
    }

    /**
     * 查询所有部门
     *
     * @return 部门列表
     */
    @Override
    public List<Dept> queryAllDept() {
        return deptMapper.queryAllDept();
    }
}
